//
//  PopCat_Snd_bannerView.m
//  MindBox
//
//  Created by MS on 16-1-11.
//  Copyright (c) 2016年 Lemon. All rights reserved.
//

#import "PopCat_Snd_bannerView.h"
#import "UIImageView+WebCache.h"
@implementation PopCat_Snd_bannerView

+(instancetype)popCat_Snd_bannerViewWithXib
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass([self class]) owner:nil options:nil] lastObject];
}

-(void)setSndArray:(NSArray *)sndArray
{
    _sndArray = sndArray;
    if (sndArray.count) {
        [_imageView0 sd_setImageWithURL:[NSURL URLWithString:((Snd_Banner *)sndArray[0]).image_url]];
        [_imageView1 sd_setImageWithURL:[NSURL URLWithString:((Snd_Banner *)sndArray[1]).image_url]];
    }
    
}

-(void)awakeFromNib
{
    [self addTapWithImageView:_imageView0];
    [self addTapWithImageView:_imageView1];
    
}

-(void) addTapWithImageView:(UIImageView *)imageView
{
    imageView.userInteractionEnabled = YES;
    
    UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapEvent:)];
    [imageView addGestureRecognizer:tap];
    
}

-(void)tapEvent:(UIGestureRecognizer *)tap
{
    if (self.PopCatSndBlock) {
        _PopCatSndBlock(tap.view.tag);
    }
    
}

@end
